﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Xpus.Website.Core.Membership;
using Xpus.Website.Data;

namespace Xpus.Website.Core.WebPage
{
	/// <summary>
	/// 用户访问的目标。
	/// </summary>
	public enum XpusRequestTarget
	{
		/// <summary>
		/// 用户访问的是一个区域。
		/// </summary>
		Area,

		/// <summary>
		/// 用户访问的是一个内容页。
		/// </summary>
		Content,
	}

	/// <summary>
	/// 表示访问xpus的.x页面时的上下文环境。
	/// </summary>
	public sealed class XpusContext
	{
		/// <summary>
		/// 构造XPUS上下文。
		/// </summary>
		/// <param name="httpContext">HTTP上下文。</param>
		/// <param name="requestTarget">请求目标。</param>
		/// <param name="area">当前访问区域。</param>
		/// <param name="content">当前访问内容。</param>
		internal XpusContext(HttpContext httpContext, XpusRequestTarget requestTarget, Area area, Content content)
		{
			this.HttpContext = httpContext;
			this.UserPrincipal = (XpusUserPrincipal)httpContext.User;
			this.RequestTarget = requestTarget;
			this.Area = area;
			this.Content = content;
		}

		/// <summary>
		/// 获取HTTP上下文。
		/// </summary>
		public HttpContext HttpContext
		{
			get;
			private set;
		}

		/// <summary>
		/// 获取当前登录的用户凭证。
		/// </summary>
		public XpusUserPrincipal UserPrincipal
		{
			get;
			private set;
		}

		/// <summary>
		/// 获取用户正在访问的目标。
		/// </summary>
		public XpusRequestTarget RequestTarget
		{
			get;
			private set;
		}

		/// <summary>
		/// 获取用户访问的区域。
		/// </summary>
		public Area Area
		{
			get;
			private set;
		}

		/// <summary>
		/// 获取用户访问的内容。
		/// </summary>
		public Content Content
		{
			get;
			private set;
		}
	}

	/// <summary>
	/// 用于处理某一种页面。
	/// </summary>
	public abstract class XpusWebPage
	{
	}
}
